#!/bin/bash
#foreach($entry in $map.entrySet())
if [ -f $entry.value$entry.key ]; then
    mv "$entry.value$entry.key" "${DEST_DIR}"
    echo "文件已移动至 ${DEST_DIR}"
else
    echo "$entry.key 工作目录中不存在该组件"
fi

if [ -f ${UPDATE_DIR}$entry.key ]; then
    mv "${UPDATE_DIR}$entry.key" "$entry.value"
echo "文件已移动至 $entry.value"
    else
echo "$entry.key 更新目录中不存在该组件"
fi
#end
cd ${WORK_DIR}
docker-compose down
docker-compose up -d

if [ -f ${UPDATE_DIR}dist.zip ];then
    if [ -d ${DIST_DIR}dist ];then
        zip -r ${LiShiDistZip}.zip ${DIST_DIR}dist/
        mv "${DIST_DIR}${LiShiDistZip}.zip" "${DEST_DIR}"
        rm -rf ${DIST_DIR}dist
    fi
    mv ${UPDATE_DIR}dist.zip  ${DIST_DIR}
    unzip dist.zip
    docker restart ${nginxName}
fi
